package com.sq.partner.manager.dao.impl;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;





import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

import com.sq.partner.manager.dao.TradPlanSaleDao;
import com.sq.partner.manager.mybatis.model.TradPlanSale;
import com.sq.partner.manager.mybatis.model.TradSaleAgent;
import com.sq.partner.manager.util.LogUtil;


/**
 * 
 * @author Kang Zhiqiang
 *
 */
@Repository
public class TradPlanSaleDaoImpl extends BaseDaoImpl implements TradPlanSaleDao {
	private static Logger logger = LogUtil.getLog(TradPlanSaleDaoImpl.class);

	@Override
	public List<TradPlanSale> queryTrade(Map<String, String> map) throws SQLException {
		return this.queryList("queryTradPlanSale", map);
	}

	@Override
	public void deleteTrade(Map<String, String> map) throws Exception {
		this.delete("deleteTradPlanSale", map);
	}

	@Override
	public boolean addTrade(List<TradPlanSale> tradPlanSale) {
		 try {
			this.batchInsert("insertTradPlanSale", tradPlanSale);
			return true;
		} catch (Exception e) {
			logger.error(e);		
			return false;
		}
	}
	@Override
	public List<TradPlanSale> searchTradPlanSalesByplanCode(
			Map<String, Object> maps) throws Exception {
		// TODO Auto-generated method stub
		return this.queryList("searchTradPlanSalesByplanCode", maps);
	}

	@Override
	public List<Map<String, Object>> searchTradSaleAgentsByplanCode(
			Map<String, Object> maps) throws Exception {
		// TODO Auto-generated method stub
		return this.queryList("searchTradSaleAgentsByplanCode", maps);
	}

	@Override
	public List<Map<String, Object>> impNlifeSale(Map<String, Object> map)
			throws Exception {
		return this.queryList("impNlifeSaleMap", map);
	}
	
}
